Recherche avancée

Médias (91)

Autres articles (75)

  • Participer à sa traduction

    10 avril 2011

    Vous pouvez nous aider à améliorer les locutions utilisées dans le logiciel ou à traduire celui-ci dans n’importe qu’elle nouvelle langue permettant sa diffusion à de nouvelles communautés linguistiques.
    Pour ce faire, on utilise l’interface de traduction de SPIP où l’ensemble des modules de langue de MediaSPIP sont à disposition. ll vous suffit de vous inscrire sur la liste de discussion des traducteurs pour demander plus d’informations.
    Actuellement MediaSPIP n’est disponible qu’en français et (...)

  • MediaSPIP Core : La Configuration

    9 novembre 2010, par

    MediaSPIP Core fournit par défaut trois pages différentes de configuration (ces pages utilisent le plugin de configuration CFG pour fonctionner) : une page spécifique à la configuration générale du squelettes ; une page spécifique à la configuration de la page d’accueil du site ; une page spécifique à la configuration des secteurs ;
    Il fournit également une page supplémentaire qui n’apparait que lorsque certains plugins sont activés permettant de contrôler l’affichage et les fonctionnalités spécifiques (...)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

Sur d’autres sites (8591)

  • Xuggle - Concatenate two videos - Error - java.lang.RuntimeException : error -1094995529 decoding audio

    1er avril 2013, par user2232357

    I am using the Xuggle API to concatenate two MPEG videos (with Audio inbuilt in the MPEGs).
    I am referring to the https://code.google.com/p/xuggle/source/browse/trunk/java/xuggle-xuggler/src/com/xuggle/mediatool/demos/ConcatenateAudioAndVideo.java?r=929. (my both inputs and output are MPEGs).

    Getting the bellow error.

    14:06:50.139 [main] ERROR org.ffmpeg - [mp2 @ 0x7fd54693d000] incomplete frame
    java.lang.RuntimeException: error -1094995529 decoding audio
       at com.xuggle.mediatool.MediaReader.decodeAudio(MediaReader.java:549)
       at com.xuggle.mediatool.MediaReader.readPacket(MediaReader.java:469)
       at com.tav.factory.video.XuggleMediaCreator.concatenateAllVideos(XuggleMediaCreator.java:271)
       at com.tav.factory.video.XuggleMediaCreator.main(XuggleMediaCreator.java:446)

    Can anyone help mw with this ??? Thanks in Advance..

    Here is the complete code.

    public String concatenateAllVideos(ArrayList<tavtexttoavrequest> list){
           String finalPath="";


           String sourceUrl1 = "/Users/SSID/WS/SampleTTS/page2/AV_TAVImage2.mpeg";
           String sourceUrl2 = "/Users/SSID/WS/SampleTTS/page2/AV_TAVImage3.mpeg";
           String destinationUrl = "/Users/SSID/WS/SampleTTS/page2/z_AV_TAVImage_Final23.mpeg";

           out.printf("transcode %s + %s -> %s\n", sourceUrl1, sourceUrl2,
             destinationUrl);

           //////////////////////////////////////////////////////////////////////
           //                                                                  //
           // NOTE: be sure that the audio and video parameters match those of //
           // your input media                                                 //
           //                                                                  //
           //////////////////////////////////////////////////////////////////////

           // video parameters

           final int videoStreamIndex = 0;
           final int videoStreamId = 0;
           final int width = 400;
           final int height = 400;

           // audio parameters

           final int audioStreamIndex = 1;
           final int audioStreamId = 0;
           final int channelCount = 1;
           final int sampleRate = 16000 ; // Hz 16000 44100;

           // create the first media reader

           IMediaReader reader1 = ToolFactory.makeReader(sourceUrl1);

           // create the second media reader

           IMediaReader reader2 = ToolFactory.makeReader(sourceUrl2);

           // create the media concatenator

           MediaConcatenator concatenator = new MediaConcatenator(audioStreamIndex,
             videoStreamIndex);

           // concatenator listens to both readers

           reader1.addListener(concatenator);
           reader2.addListener(concatenator);

           // create the media writer which listens to the concatenator

           IMediaWriter writer = ToolFactory.makeWriter(destinationUrl);
           concatenator.addListener(writer);

           // add the video stream

           writer.addVideoStream(videoStreamIndex, videoStreamId, width, height);

           // add the audio stream

           writer.addAudioStream(audioStreamIndex, audioStreamId, channelCount,sampleRate);

           // read packets from the first source file until done

           try {
               while (reader1.readPacket() == null)
                 ;
           } catch (Exception e) {
               // TODO Auto-generated catch block
               e.printStackTrace();
           }

           // read packets from the second source file until done

           try {
               while (reader2.readPacket() == null)
                 ;
           } catch (Exception e) {
               // TODO Auto-generated catch block
               e.printStackTrace();
           }

           // close the writer

           writer.close();


           return finalPath;
       }

       static class MediaConcatenator extends MediaToolAdapter
         {
           // the current offset

           private long mOffset = 0;

           // the next video timestamp

           private long mNextVideo = 0;

           // the next audio timestamp

           private long mNextAudio = 0;

           // the index of the audio stream

           private final int mAudoStreamIndex;

           // the index of the video stream

           private final int mVideoStreamIndex;

           /**
            * Create a concatenator.
            *
            * @param audioStreamIndex index of audio stream
            * @param videoStreamIndex index of video stream
            */

           public MediaConcatenator(int audioStreamIndex, int videoStreamIndex)
           {
             mAudoStreamIndex = audioStreamIndex;
             mVideoStreamIndex = videoStreamIndex;
           }

           public void onAudioSamples(IAudioSamplesEvent event)
           {
             IAudioSamples samples = event.getAudioSamples();

             // set the new time stamp to the original plus the offset established
             // for this media file

             long newTimeStamp = samples.getTimeStamp() + mOffset;

             // keep track of predicted time of the next audio samples, if the end
             // of the media file is encountered, then the offset will be adjusted
             // to this time.

             mNextAudio = samples.getNextPts();

             // set the new timestamp on audio samples

             samples.setTimeStamp(newTimeStamp);

             // create a new audio samples event with the one true audio stream
             // index

             super.onAudioSamples(new AudioSamplesEvent(this, samples,
               mAudoStreamIndex));
           }

           public void onVideoPicture(IVideoPictureEvent event)
           {
             IVideoPicture picture = event.getMediaData();
             long originalTimeStamp = picture.getTimeStamp();

             // set the new time stamp to the original plus the offset established
             // for this media file

             long newTimeStamp = originalTimeStamp + mOffset;

             // keep track of predicted time of the next video picture, if the end
             // of the media file is encountered, then the offset will be adjusted
             // to this this time.
             //
             // You&#39;ll note in the audio samples listener above we used
             // a method called getNextPts().  Video pictures don&#39;t have
             // a similar method because frame-rates can be variable, so
             // we don&#39;t now.  The minimum thing we do know though (since
             // all media containers require media to have monotonically
             // increasing time stamps), is that the next video timestamp
             // should be at least one tick ahead.  So, we fake it.

             mNextVideo = originalTimeStamp + 1;

             // set the new timestamp on video samples

             picture.setTimeStamp(newTimeStamp);

             // create a new video picture event with the one true video stream
             // index

             super.onVideoPicture(new VideoPictureEvent(this, picture,
               mVideoStreamIndex));
           }

           public void onClose(ICloseEvent event)
           {
             // update the offset by the larger of the next expected audio or video
             // frame time

             mOffset = Math.max(mNextVideo, mNextAudio);

             if (mNextAudio &lt; mNextVideo)
             {
               // In this case we know that there is more video in the
               // last file that we read than audio. Technically you
               // should pad the audio in the output file with enough
               // samples to fill that gap, as many media players (e.g.
               // Quicktime, Microsoft Media Player, MPlayer) actually
               // ignore audio time stamps and just play audio sequentially.
               // If you don&#39;t pad, in those players it may look like
               // audio and video is getting out of sync.

               // However kiddies, this is demo code, so that code
               // is left as an exercise for the readers. As a hint,
               // see the IAudioSamples.defaultPtsToSamples(...) methods.
             }
           }

           public void onAddStream(IAddStreamEvent event)
           {
             // overridden to ensure that add stream events are not passed down
             // the tool chain to the writer, which could cause problems
           }

           public void onOpen(IOpenEvent event)
           {
             // overridden to ensure that open events are not passed down the tool
             // chain to the writer, which could cause problems
           }

           public void onOpenCoder(IOpenCoderEvent event)
           {
             // overridden to ensure that open coder events are not passed down the
             // tool chain to the writer, which could cause problems
           }

           public void onCloseCoder(ICloseCoderEvent event)
           {
             // overridden to ensure that close coder events are not passed down the
             // tool chain to the writer, which could cause problems
           }
         }
    </tavtexttoavrequest>
  • Getting Error during executin native android code

    3 avril 2013, par dilipkaklotar

    Error on my console

    bash : cannot set terminal process group (-1) : Inappropriate ioctl for device
    bash : no job control in this shell
    Your group is currently "mkpasswd". This indicates that your
    gid is not in /etc/group and your uid is not in /etc/passwd.

    The /etc/passwd (and possibly /etc/group) files should be rebuilt.
    See the man pages for mkpasswd and mkgroup then, for example, run

    mkpasswd -l [-d] > /etc/passwd
    mkgroup -l [-d] > /etc/group

    Note that the -d switch is necessary for domain users.
    - ]0 ; -
    - [32mDILIP@DILIP-PC -[33m -[0m
    $

    public class VideoBrowser extends ListActivity implements ListView.OnScrollListener {

    /*this part communicates with native code through jni (java native interface)*/
    //load the native library
    static {
       System.loadLibrary("ffmpeg");
       System.loadLibrary("ffmpeg-test-jni");
    }
    //declare the jni functions
    private static native void naInit(String _videoFileName);
    private static native int[] naGetVideoResolution();
    private static native String naGetVideoCodecName();
    private static native String naGetVideoFormatName();
    private static native void naClose();

    private void showVideoInfo(final File _file) {
       String videoFilename = _file.getAbsolutePath();
       naInit(videoFilename);
       int[] prVideoRes = naGetVideoResolution();
       String prVideoCodecName = naGetVideoCodecName();
       String prVideoFormatName = naGetVideoFormatName();
       naClose();
       String displayText = "Video: " + videoFilename + "\n";
       displayText += "Video Resolution: " + prVideoRes[0] + "x" + prVideoRes[1] + "\n";
       displayText += "Video Codec: " + prVideoCodecName + "\n";
       displayText += "Video Format: " + prVideoFormatName + "\n";
       text_titlebar_text.setText(displayText);
    }


    /*the rest of the file deals with UI and other stuff*/
    private Context mContext;
    public static VideoBrowser self;

    /**
    * activity life cycle: this part of the source code deals with activity life cycle
    */
    @Override
    public void onCreate(Bundle icicle) {
       super.onCreate(icicle);
       mContext = this.getApplicationContext();
       self = this;
       initUI();
    }

    @Override
    protected void onDestroy() {
       super.onDestroy();
       unbindDisplayEntries();
    }

    public void unbindDisplayEntries() {
       if (displayEntries!=null) {
           int l_count = displayEntries.size();
           for (int i = 0; i &lt; l_count; ++i) {
               IconifiedTextSelected l_its = displayEntries.get(i);
               if (l_its != null) {
                   Drawable l_dr = l_its.getIcon();
                   if (l_dr != null) {
                       l_dr.setCallback(null);
                       l_dr = null;
                   }
               }
           }
       }
       if (l_displayEntries!=null) {
           int l_count = l_displayEntries.size();
           for (int i = 0; i &lt; l_count; ++i) {
               IconifiedTextSelected l_its = l_displayEntries.get(i);
               if (l_its != null) {
                   Drawable l_dr = l_its.getIcon();
                   if (l_dr != null) {
                       l_dr.setCallback(null);
                       l_dr = null;
                   }
               }
           }
       }
    }

    /**
    * Data: this part of the code deals with data processing
    */
    public List<iconifiedtextselected> displayEntries = new ArrayList<iconifiedtextselected>();
    public static List<iconifiedtextselected> l_displayEntries = new ArrayList<iconifiedtextselected>();;

    /**load images
    * this part of code deals with loading of images
    */
    private File currentDirectory;
    public int media_browser_load_option = 2;
    private static int last_media_browser_load_option = 2;
    private static int number_of_icons = 0;
    private static final String upOneLevel = "..";

    LoadVideoTask loadTask;
    private void loadVideosFromDirectory(String _dir) {
       try {
           loadTask = new LoadVideoTask();
           loadTask.execute(_dir);
       } catch (Exception e) {
           Toast.makeText(this, "Load media fail!", Toast.LENGTH_SHORT).show();
       }
    }

    private void getVideosFromDirectoryNonRecurAddParent(File _dir) {
       //add the upper one level data
       if (_dir.getParent()!=null) {
           this.displayEntries.add(new IconifiedTextSelected(
                   upOneLevel,
                   getResources().getDrawable(R.drawable.folderback),
                   false, false, 0));
       }
    }

    private void getVideosFromDirectoryNonRecur(File _dir) {
       Drawable folderIcon = this.getResources().getDrawable(R.drawable.normalfolder);
       //add the
       if (!_dir.isDirectory()) {
           return;
       }
       File[] files = _dir.listFiles();
       if (files == null) {
           return;
       }
       Drawable videoIcon = null;
       int l_iconType = 0;
       for (File currentFile : files) {
           if (currentFile.isDirectory()) {
               //if it&#39;s a directory
               this.displayEntries.add(new IconifiedTextSelected(
                       currentFile.getPath(),
                       folderIcon, false, false, 0));
           } else {
               String l_filename = currentFile.getName();
               if (checkEndsWithInStringArray(l_filename,
                           getResources().getStringArray(R.array.fileEndingVideo))) {
                   if (number_of_icons &lt; 10) {
                       videoIcon = null;
                       ++number_of_icons;
                       l_iconType = 22;
                   } else {
                       videoIcon = null;
                       l_iconType = 2;
                   }
                   this.displayEntries.add(new IconifiedTextSelected(
                           currentFile.getPath(),
                           videoIcon, false, false, l_iconType));
               }
           }
       }
    }

    private void getVideosFromDirectoryRecur(File _dir) {
       Drawable videoIcon = null;
       File[] files = _dir.listFiles();
       int l_iconType = 2;
       if (files == null) {
           return;
       }
       for (File currentFile : files) {
           if (currentFile.isDirectory()) {
               getVideosFromDirectoryRecur(currentFile);
               continue;
           } else {
               String l_filename = currentFile.getName();
               //if it&#39;s an image file
               if (checkEndsWithInStringArray(l_filename,
                       getResources().getStringArray(R.array.fileEndingVideo))) {
                   if (number_of_icons &lt; 10) {
                       videoIcon = null;
                       ++number_of_icons;
                       l_iconType = 22;
                   } else {
                       videoIcon = null;
                       l_iconType = 2;
                   }
                   this.displayEntries.add(new IconifiedTextSelected(
                           currentFile.getPath(),
                           videoIcon, false, false, l_iconType));
               }
           }
       }
    }

    private void getVideosFromGallery() {
       Drawable videoIcon = null;
       Uri uri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
       String[] projection = {MediaStore.Video.Media.DATA};
       Cursor l_cursor = this.managedQuery(uri, projection, null, null, null);
       int videoNameColumnIndex;
       String videoFilename;
       File videoFile;
       int l_iconType = 2;
       if (l_cursor!=null) {
           if (l_cursor.moveToFirst()) {
               do {
                   videoNameColumnIndex = l_cursor.getColumnIndexOrThrow(
                           MediaStore.Images.Media.DATA);
                   videoFilename = l_cursor.getString(videoNameColumnIndex);
                   videoFile = new File(videoFilename);
                   if (!videoFile.exists()) {
                       continue;
                   }
                   if (number_of_icons &lt;= 10) {
                       videoIcon = null;
                       ++number_of_icons;
                       l_iconType = 22;
                   } else {
                       videoIcon = null;
                       l_iconType = 2;
                   }
                   this.displayEntries.add(new IconifiedTextSelected(
                           videoFile.getAbsolutePath(),
                           videoIcon, false, false, l_iconType));
               } while (l_cursor.moveToNext());
           }
       }
       if (l_cursor!=null) {
           l_cursor.close();
       }
    }

    private boolean checkEndsWithInStringArray(String checkItsEnd,
           String[] fileEndings){
       for(String aEnd : fileEndings){
           if(checkItsEnd.endsWith(aEnd))
               return true;
       }
       return false;
    }

    private class LoadVideoTask extends AsyncTask {
       @Override
       protected void onPreExecute() {
           System.gc();
           displayEntries.clear();
           showDialog(DIALOG_LOAD_MEDIA);
       }
       @Override
       protected Void doInBackground(String... params) {
           File l_root = new File(params[0]);
           if (l_root.isDirectory()) {
               number_of_icons = 0;
               currentDirectory = l_root;
               if (media_browser_load_option == 0) {
                   //list all videos in the root directory without going into sub folder
                   getVideosFromDirectoryNonRecurAddParent(l_root);
                   getVideosFromDirectoryNonRecur(l_root);
               } else if (media_browser_load_option == 1) {
                   //list all videos in the root folder recursively
                   getVideosFromDirectoryRecur(l_root);
               } else if (media_browser_load_option == 2) {
                   //list all videos in the gallery
                   getVideosFromGallery();
               }
           }
           return null;
       }
       @Override
       protected void onPostExecute(Void n) {
           refreshUI();
           dismissDialog(DIALOG_LOAD_MEDIA);
       }
    }

    /**
    * UI: this part of the source code deals with UI
    */
    //bottom menu
    private int currentFocusedBtn = 1;
    private Button btn_bottommenu1;
    private Button btn_bottommenu2;
    private Button btn_bottommenu3;
    //private Button btn_bottommenu4;
    //title bar
    private TextView text_titlebar_text;

    private void initUI() {
       this.requestWindowFeature(Window.FEATURE_NO_TITLE);
       this.setContentView(R.layout.video_browser);
       //title bar
       text_titlebar_text = (TextView) findViewById(R.id.titlebar_text);
       text_titlebar_text.setText("Click a video to display info");

       //bottom menu
       int l_btnWidth = this.getWindowManager().getDefaultDisplay().getWidth()/4;
       btn_bottommenu1 = (Button) findViewById(R.id.video_browser_btn1);
       //btn_bottommenu1 = (ActionMenuButton) findViewById(R.id.main_topsecretimport_btn1);
       btn_bottommenu1.setWidth(l_btnWidth);
       btn_bottommenu1.setOnClickListener(new View.OnClickListener() {
           public void onClick(View v) {
               btn_bottommenu1.setEnabled(false);
               btn_bottommenu2.setEnabled(true);
               btn_bottommenu3.setEnabled(true);
               currentFocusedBtn = 1;
               last_list_view_pos = 0;
               media_browser_load_option = 2;
               last_media_browser_load_option = media_browser_load_option;
               loadVideosFromDirectory("/sdcard/");
           }
       });
       btn_bottommenu2 = (Button) findViewById(R.id.video_browser_btn2);
       btn_bottommenu2.setWidth(l_btnWidth);
       btn_bottommenu2.setOnClickListener(new View.OnClickListener() {
           public void onClick(View v) {
               btn_bottommenu1.setEnabled(true);
               btn_bottommenu2.setEnabled(false);
               btn_bottommenu3.setEnabled(true);
               currentFocusedBtn = 2;
               last_list_view_pos = 0;
               media_browser_load_option = 0;
               last_media_browser_load_option = media_browser_load_option;
               loadVideosFromDirectory("/sdcard/");
           }
       });
       btn_bottommenu3 = (Button) findViewById(R.id.video_browser_btn3);
       btn_bottommenu3.setWidth(l_btnWidth);
       btn_bottommenu3.setOnClickListener(new View.OnClickListener() {
           public void onClick(View v) {
               btn_bottommenu1.setEnabled(true);
               btn_bottommenu2.setEnabled(true);
               btn_bottommenu3.setEnabled(false);
               currentFocusedBtn = 3;
               last_list_view_pos = 0;
               media_browser_load_option = 1;
               last_media_browser_load_option = media_browser_load_option;
               loadVideosFromDirectory("/sdcard/");
           }
       });
       media_browser_load_option = last_media_browser_load_option;
       if (media_browser_load_option==2) {
           btn_bottommenu1.setEnabled(false);
       } else if (media_browser_load_option==0) {
           btn_bottommenu2.setEnabled(false);
       } else if (media_browser_load_option==1){
           btn_bottommenu3.setEnabled(false);
       }
       loadVideosFromDirectory("/sdcard/");
    }
    //refresh the UI when the directoryEntries changes
    private static int last_list_view_pos = 0;
    public void refreshUI() {
       int l_btnWidth = this.getWindowManager().getDefaultDisplay().getWidth()/4;
       btn_bottommenu1.setWidth(l_btnWidth);
       btn_bottommenu2.setWidth(l_btnWidth);
       btn_bottommenu3.setWidth(l_btnWidth);
       //btn_bottommenu4.setWidth(l_btnWidth);

       SlowAdapter itla = new SlowAdapter(this);
       itla.setListItems(this.displayEntries);    
       this.setListAdapter(itla);
       getListView().setOnScrollListener(this);
       int l_size = this.displayEntries.size();
       if (l_size > 50) {
           getListView().setFastScrollEnabled(true);
       } else {
           getListView().setFastScrollEnabled(false);
       }
       if (l_size > 0) {
           if (last_list_view_pos &lt; l_size) {
               getListView().setSelection(last_list_view_pos);
           } else {
               getListView().setSelection(l_size-1);
           }
       }
       registerForContextMenu(getListView());
    }

    @Override
    public void onConfigurationChanged (Configuration newConfig) {
       super.onConfigurationChanged(newConfig);
       refreshUI();
    }

    static final int DIALOG_LOAD_MEDIA = 1;
    static final int DIALOG_HELP = 2;
    @Override
    protected Dialog onCreateDialog(int id) {
       switch(id) {
       case DIALOG_LOAD_MEDIA:
           ProgressDialog dialog = new ProgressDialog(this);
           dialog.setTitle("Load Files");
           dialog.setMessage("Please wait while loading...");
           dialog.setIndeterminate(true);
           dialog.setCancelable(true);
           return dialog;
       default:
           return null;
       }
    }
    /**
    * scroll events methods: this part of the source code contain the control source code
    * for handling scroll events
    */
    private boolean mBusy = false;
    private void disableButtons() {
       btn_bottommenu1.setEnabled(false);
       btn_bottommenu2.setEnabled(false);
       btn_bottommenu3.setEnabled(false);
    }

    private void enableButtons() {
       if (currentFocusedBtn!=1) {
           btn_bottommenu1.setEnabled(true);
       }
       if (currentFocusedBtn!=2) {
           btn_bottommenu2.setEnabled(true);
       }
       if (currentFocusedBtn!=3) {
           btn_bottommenu3.setEnabled(true);
       }
    }
    public void onScroll(AbsListView view, int firstVisibleItem,
           int visibleItemCount, int totalItemCount) {
       last_list_view_pos = view.getFirstVisiblePosition();
    }

    //private boolean mSaveMemory = false;
    public void onScrollStateChanged(AbsListView view, int scrollState) {      
       switch (scrollState) {
       case OnScrollListener.SCROLL_STATE_IDLE:
           enableButtons();
           mBusy = false;
           int first = view.getFirstVisiblePosition();
           int count = view.getChildCount();
           int l_releaseTarget;
           for (int i=0; i/if outofmemory, we try to clean up 10 view image resources,
                       //and try again
                       for (int j = 0; j &lt; 10; ++j) {
                           l_releaseTarget = first - count - j;
                           if (l_releaseTarget > 0) {
                               IconifiedTextSelected l_its = displayEntries.get(l_releaseTarget);
                               IconifiedTextSelectedView l_itsv = (IconifiedTextSelectedView)
                                   this.getListView().getChildAt(l_releaseTarget);
                               if (l_itsv!=null) {
                                   l_itsv.setIcon(null);
                               }
                               if (l_its != null) {
                                   Drawable l_dr = l_its.getIcon();
                                   l_its.setIcon(null);
                                   if (l_dr != null) {
                                       l_dr.setCallback(null);
                                       l_dr = null;
                                   }
                               }
                           }
                       }
                       System.gc();
                       //after clean up, we try again
                       if (l_type == 1) {
                           l_icon = null;
                       } else if (l_type == 2) {
                           l_icon = null;
                       }
                   }
                   this.displayEntries.get(first+i).setIcon(l_icon);
                   if (l_icon != null) {
                       t.setIcon(l_icon);
                       t.setTag(null);
                   }
               }
           }
           //System.gc();
           break;
       case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL:
           disableButtons();
           mBusy = true;
           break;
       case OnScrollListener.SCROLL_STATE_FLING:
           disableButtons();
           mBusy = true;
           break;
       }
    }

    /**
    * List item click action
    */
    private File currentFile;
    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
       super.onListItemClick(l, v, position, id);
       last_list_view_pos = position;
       String selectedFileOrDirName = this.displayEntries.get((int)id).getText();
       if (selectedFileOrDirName.equals(upOneLevel)) {
           if (this.currentDirectory.getParent()!=null) {
               last_list_view_pos = 0;
               browseTo(this.currentDirectory.getParentFile());
           }
       } else {
           File l_clickedFile = new File(this.displayEntries.get((int)id).getText());
           if (l_clickedFile != null) {
               if (l_clickedFile.isDirectory()) {
                   last_list_view_pos = 0;
                   browseTo(l_clickedFile);
               } else {
                   showVideoInfo(l_clickedFile);
               }
           }
       }
    }

    private void browseTo(final File _dir) {
       if (_dir.isDirectory()) {
           this.currentDirectory = _dir;
           loadVideosFromDirectory(_dir.getAbsolutePath());
       }
    }

    /**
    * Slow adapter: this part of the code implements the list adapter
    * Will not bind views while the list is scrolling
    */
    private class SlowAdapter extends BaseAdapter {
       /** Remember our context so we can use it when constructing views. */
       private Context mContext;

       private List<iconifiedtextselected> mItems = new ArrayList<iconifiedtextselected>();

       public SlowAdapter(Context context) {
           mContext = context;
       }

       public void setListItems(List<iconifiedtextselected> lit)
       { mItems = lit; }

       /** @return The number of items in the */
       public int getCount() { return mItems.size(); }

       public Object getItem(int position)
       { return mItems.get(position); }

       /** Use the array index as a unique id. */
       public long getItemId(int position) {
           return position;
       }

       /** @param convertView The old view to overwrite, if one is passed
        * @returns a IconifiedTextSelectedView that holds wraps around an IconifiedText */
       public View getView(int position, View convertView, ViewGroup parent) {
           IconifiedTextSelectedView btv;
           if (convertView == null) {
               btv = new IconifiedTextSelectedView(mContext, mItems.get(position));
           } else { // Reuse/Overwrite the View passed
               // We are assuming(!) that it is castable!
               btv = (IconifiedTextSelectedView) convertView;
               btv.setText(mItems.get(position).getText());
           }
           if (position==0) {
               if (VideoBrowser.self.media_browser_load_option==0) {
                   btv.setIcon(R.drawable.folderback);
               } else if (mItems.get(0).getIcon()!=null) {
                   btv.setIcon(mItems.get(position).getIcon());
               } else {
                   btv.setIcon(R.drawable.video);
               }
           }
           //in busy mode
           else if (mBusy){
               //if icon is NULL: the icon is not loaded yet; load default icon
               if (mItems.get(position).getIcon()==null) {
                   btv.setIcon(R.drawable.video);
                   //mark this view, indicates the icon is not loaded
                   btv.setTag(this);
               } else {
                   //if icon is not null, just display the icon
                   btv.setIcon(mItems.get(position).getIcon());
                   //mark this view, indicates the icon is loaded
                   btv.setTag(null);
               }
           } else {
               //if not busy
               Drawable d = mItems.get(position).getIcon();
               if (d == null) {
                   //icon is not loaded, load now
                   btv.setIcon(R.drawable.video);
                   btv.setTag(this);
               } else {
                   btv.setIcon(mItems.get(position).getIcon());
                   btv.setTag(null);
               }
           }
           return btv;
       }
    }
    </iconifiedtextselected></iconifiedtextselected></iconifiedtextselected></iconifiedtextselected></iconifiedtextselected></iconifiedtextselected></iconifiedtextselected>

    }

  • PHP FFmpeg video aspect ratio problem

    18 mai 2013, par Herr K

    i compiled the new version of FFMPEG and the padding commands have been deprecated.
    As i try to get familiar with the new -vf pad= commands, i want to ask, how can i
    convert a video without changing it's aspect ratio.

    I've checked numerous solutions from stackoverflow, nothing seemed to work.
    Can someone, please post a working PHP example or cmd line. I would be VERY happy.

    Please note that the videos in question, could be 4:3 and also be 16:9

    Let's say, i convert a 16:9 video to 640x480 format. It will need some bars at
    the top and at the bottom. That is what i want to do.

    Thanks